const Timestamp = new Date().getTime();
module.exports = {
  publicPath: process.env.NODE_ENV === "development" ? "/" : "./",
  outputDir: "dist",
  assetsDir: "static",
  indexPath: "index.html",
  configureWebpack: {
    output: {
      filename: `static/js/[name].${process.env.VUE_APP_VERSION}.${Timestamp}.js`,
      chunkFilename: `static/js/[name].${process.env.VUE_APP_VERSION}.${Timestamp}.js`,
    },
    devtool: process.env.NODE_ENV === 'development' ? 'source-map' : undefined,
  },
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
  lintOnSave: false,
  devServer: {
    open: false,
    compress: false,
    proxy: {
      "/apis": {
        target: "http://192.168.31.180:8000",
        changeOrigin: true,
        pathRewrite: {
          "^/apis": "",
        },
      },
    },
  },
  chainWebpack: (config) => {
    config.entry("main").add("babel-polyfill");
    config.plugin('html')
      .tap(args => {
        args[0].title = "模板";
        return args;
      })
  },
};
